Ext.define('ES.controller.component.ComponentController',{
	extend:'Ext.app.Controller',
	 views: [
        'components.Components'
    ],
    refs: [
        {
            ref: 'comp',
            selector: 'componentspage'
        }
    ],
    requires:['ES.model.component.ComponentsModel', 'ES.store.component.ComponentsStore','ES.store.component.CompCategoryStore','ES.view.uploadComp.UploadComp'],
    models:['component.ComponentsModel'],
    stores:['component.ComponentsStore','component.CompCategoryStore'],
	init:function(){
		this.control({
			'#compContainer':{
				render: this.onPanelRendered
			},
			'#uploadButton':{
				click:this.uploadButtonClick
			}
		});
	},
	onPanelRendered: function() {		this.getComp().makeCompData(this.getStore('component.ComponentsStore'));
		this.getComp().loadTree(this.getStore('component.CompCategoryStore'));
    },
    uploadButtonClick:function(){
    	Ext.create('ES.view.uploadComp.UploadComp').show();
    }
});